<script setup>
import {useRouter} from "vue-router";
import {onMounted, ref} from "vue";

const index = ref('')
const router = useRouter();
onMounted(() => {
  if(router.currentRoute.value.path.includes('/home')){
    index.value='user'
  }
  else if(router.currentRoute.value.path.includes('/house')){
    index.value='house'
  }
})
</script>

<template>
  <div>
    <el-menu
        style="width: 200px"
        :default-active="index"
        class="el-menu-vertical-demo"
    >
      <el-sub-menu index="1">
        <template #title >系统管理</template>
        <el-menu-item index="user" @click="this.$router.push('/home'); ">用户管理</el-menu-item>
      </el-sub-menu>
      <el-sub-menu index="2">
        <template #title>数据管理</template>
        <el-menu-item index="house" @click="this.$router.push('/house'); ">房产管理</el-menu-item>
      </el-sub-menu>
    </el-menu>
  </div>
</template>

<style scoped>
/* .el-menu-item {
  font-size: 24px; 
} */
</style>
